
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>线程池实现的是什么接口 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>线程池实现的是什么接口 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在Java中，线程池最基本的任务执行框架是什么接口？它的核心作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">最基本的接口是 Executor。其主要作用是将任务提交与任务的实际执行分离开来，从而允许实现不同的执行策略。</div>
          </div>
          <div class="card-source">来源: 线程池实现的关键接口 / 1. Executor接口</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">ExecutorService接口相比于其父接口Executor，扩展了哪些关键能力？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">ExecutorService接口增加了管理和控制任务执行的能力，提供了生命周期管理方法（如shutdown, isTerminated等），以及更高级的功能，例如任务提交（submit）、批量任务执行（invokeAll）、任务取消和监控等。</div>
          </div>
          <div class="card-source">来源: 线程池实现的关键接口 / 2. ExecutorService接口</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">创建ThreadPoolExecutor实例时，需要配置哪五个核心参数？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">创建ThreadPoolExecutor需要配置五个核心参数：corePoolSize（核心线程池大小）、maximumPoolSize（最大线程池大小）、keepAliveTime（非核心线程空闲时间）、unit（时间单位）和workQueue（任务队列）。</div>
          </div>
          <div class="card-source">来源: 线程池的实现类 / 1. ThreadPoolExecutor</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如果需要延迟执行或周期性地执行任务，应该使用哪种线程池实现类？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应该使用 ScheduledThreadPoolExecutor，它是一个可以调度任务在给定延迟后运行或周期性执行的线程池实现类。</div>
          </div>
          <div class="card-source">来源: 线程池的实现类 / 2. ScheduledThreadPoolExecutor</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">Executors工厂类提供的 FixedThreadPool 和 CachedThreadPool 分别适用于什么场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">FixedThreadPool（固定大小的线程池）适用于负载稳定的场景；CachedThreadPool（大小不固定的线程池）适用于处理大量短期任务的场景。</div>
          </div>
          <div class="card-source">来源: 线程池的类型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">当需要保证任务严格按照提交顺序执行时，应该选择Executors工厂类创建的哪种线程池？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应该选择 SingleThreadExecutor，它是一个单线程执行器，适用于需要保证任务顺序执行的场景。</div>
          </div>
          <div class="card-source">来源: 线程池的类型</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
